package name.huzhenbo.java.threads;

class DeadLockWorkQueue<T> extends WorkQueue<T> {

    @Override
    protected void processItem(final T workItem) throws InterruptedException {
        Thread child = new Thread() {
            @Override
            public void run() {
                enqueue(workItem);
            }
        };

        child.start();
        child.join();
        // Dead lock! The object 'queue' was already synchronized by the outer thread. Actually Java provides recursive lock,
        // which means that one thread could synchronize one object multiple times.
    }
}
